//
//  main.cpp
//  内存管理
//
//  Created by 卜绎皓 on 2022/10/9.
//

#include <iostream>

int main()
{
    //malloc失败返回空
    char* p1 = (char*)malloc(0xffffffff);
    if (p1 == NULL)
    {
        printf("malloc fail\n");
    }
    else
    {
        printf("malloc success:%p\n",p1);
    }
    //new失败抛异常
    char* p2 = new char[0x7111111];
    if (p2 == NULL)
    {
        printf("malloc fail\n");
    }
    else
    {
        printf("malloc success:%p\n", p2);
    }
    return 0;
}
